//
//  DateUtil.m
//  TestString
//
//  Created by simon on 10-9-28.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "DateUtil.h"


@implementation DateUtil


+(int) diffBetweenDateStr:(NSString*)dateStr1 andDateStr:(NSString*)dateStr2{
	
	int year1 = [[dateStr1 substringToIndex:4] intValue];
	int month1 = [[[dateStr1 substringToIndex:7] substringFromIndex:5] intValue];
	int day1 = [[[dateStr1 substringToIndex:10] substringFromIndex:8] intValue];
	
	int year2 = [[dateStr2 substringToIndex:4] intValue];
	int month2 = [[[dateStr2 substringToIndex:7] substringFromIndex:5] intValue];
	int day2 = [[[dateStr2 substringToIndex:10] substringFromIndex:8] intValue];
	
	
	if(year1 > year2){
		return 1;
	}else if(year1 < year2){
		return 0;
	}else { 
		if(month1 > month2){
			return 1;
		}else if(month1 < month2){
			return 0;
		}else {
			if(day1 > day2){
				return 1;
			}else if(day1 < day2){
				return 0;
			}else {
				return 2;
			}
		}
	}

}


@end
